package com.manage.competition.service.impl;

import com.manage.competition.entity.SignUpInformation;
import com.manage.competition.mapper.SignUpInformationMapper;
import com.manage.competition.service.ISignupInformationService;
import com.manage.competition.util.CurrentUserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Create with IDEA
 *
 * @Author: gitee.com/KamisamaXX
 * @Date: Create in 17:07 2019/3/29
 * @Description:
 */
@Service
public class SignupInformationServiceImpl implements ISignupInformationService {

    @Autowired
    private SignUpInformationMapper signUpInformationMapper;

    @Override
    public int insert(SignUpInformation signUpInformation) {
        signUpInformation.setCreateUser(CurrentUserUtil.getCurrentUser().getUsername());
        signUpInformation.setUpdateUser(CurrentUserUtil.getCurrentUser().getUsername());
        return signUpInformationMapper.insert(signUpInformation);
    }

    @Override
    public int update(SignUpInformation signUpInformation) {
        signUpInformation.setUpdateUser(CurrentUserUtil.getCurrentUser().getUsername());
        return signUpInformationMapper.updateByPrimaryKeySelective(signUpInformation);
    }

    @Override
    public int deleteByPrimaryKey(Long signupInformationId) {
        return signUpInformationMapper.deleteByPrimaryKey(signupInformationId);
    }


}
